#include "ET++.ph"
#ifdef __GNUG__
#pragma implementation
#endif

#include "LineItem.h"

#include "Class.h"
#include "Look.h"

//---- LineItem ----------------------------------------------------------------

NewMetaImpl(LineItem,VObject, (TB(dir), T(lineWidth), T(minLength)));

LineItem::LineItem(bool d, int lw, int ml, int id)
			: dir(d), lineWidth(lw), minLength(ml), VObject(id)
{
}

Metric LineItem::GetMinSize()
{
	if (dir)
		return Metric(minLength, lineWidth);
	return Metric(lineWidth, minLength);
}

void LineItem::Draw(Rectangle)
{
	GrPaintRect(contentRect, Enabled() ? ePatBlack : gLook->DisableInk());
}

OStream& LineItem::PrintOn (OStream& o)
{
	VObject::PrintOn(o);
	return o <<lineWidth SP << minLength SP << dir NL;
}

IStream& LineItem::ReadFrom(IStream& i)
{
	VObject::ReadFrom(i);
	return i >> lineWidth >> minLength >> Bool(dir);
}

